<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<f:metadata>
	<f:viewParam name="page" value="#{wiki.name}"/>
</f:metadata>
<ui:composition template="main.xhtml">
	<ui:define name="content">		
		<h:form prependId="false">
			<h:panelGrid columns="2" styleClass="wiki-top-menu" columnClasses="name,buttons">
				<h:panelGroup layout="block">
					<h:outputText value="#{wiki.name}" />
				</h:panelGroup>
				<h:panelGroup layout="block">
					<h:commandButton id="editingButton" value="#{wikiMessages.edit}" action="#{wiki.edit}" disabled="#{wiki.editing}">
						<f:ajax event="action" execute="@form" render="@form" onevent="lockerAjaxResponse" />
					</h:commandButton>
					<h:commandButton id="browsingButton" value="#{wikiMessages.browse}" action="#{wiki.browse}" disabled="#{wiki.browsing}">
						<f:ajax event="action" execute="@form" render="@form" onevent="lockerAjaxResponse" />
					</h:commandButton>
					<h:commandButton id="savingButton" value="#{wikiMessages.save}" action="#{wiki.save}" disabled="#{wiki.saved}">
						<f:ajax event="action" execute="@form" render="@this" onevent="lockerAjaxResponse" />
					</h:commandButton>
					<h:commandButton id="refreshButton" value="#{wikiMessages.rollBack}" action="#{wiki.rollBack}" disabled="#{wiki.saved}" />
				</h:panelGroup>
			</h:panelGrid>
			<h:outputText id="html" escape="false" value="#{wiki.HTML}" rendered="#{wiki.browsing}" styleClass="wiki" />
			<h:inputTextarea id="code" value="#{wiki.code}" rendered="#{wiki.editing}" styleClass="wiki-editor"/>
		</h:form>				
	</ui:define>
</ui:composition>
</html>